import React, { useState, useEffect, useCallback } from 'react'
import request from '@/utils/request'
import {
    message,
    Form,
    Input,
    Button,
    Radio,
    Select,
    Cascader,
    DatePicker,
    InputNumber,
    TreeSelect,
    Switch,
    Rate,
} from 'antd';
import InterviewForm from './Form'

function Edit(props) {
    // state = {
    //     data: {}
    // }
    const [datalist, setData] = useState({})
    const getData = useCallback(async () => {
        const url = props.match.path.split('/')[3]
        // console.log("Edit",props);
        const { doubanId } = props.match.params;
        const { data } = await request.get(`/detailTv/detail/${doubanId}`, {
            params:{
                collectionName:url
            }
        })

        // this.setState({
        //     data: data.data
        // })
        setData(function () {
            return data
        })

        // this.myform.setFieldsValue(data.data)
    }, [])
    // const onFinish = async (values) => {
    //     console.log('values', values)

    //     const {data} = await request.patch('/iq/'+_id,values)
    //     console.log('data=',data)
    //     if(data.code=== 200){
    //         message.success('修改成功')
    //     }
    // }
    useEffect(function () {

        getData()
    }, [])
    // componentDidMount() {
    //     this.getData();
    // }

    // const { data } = this.state;
    return (
        <>
            <InterviewForm data={datalist} props={props} />
            {/* <div>1353112</div> */}

        </>
    )

}
export default Edit;